package com.qh.propertytest;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private Button btn_build_info;
    private Button btn_get_prop;
    private Button btn_set_prop;
    private TextView tv_show;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initUI();
    }

    private void initUI() {
        btn_build_info= (Button)findViewById(R.id.btn_build_info);
        btn_build_info.setOnClickListener(this);
        btn_get_prop= (Button)findViewById(R.id.btn_get_prop);
        btn_get_prop.setOnClickListener(this);
        btn_set_prop = (Button)findViewById(R.id.btn_set_prop);
        btn_set_prop.setOnClickListener(this);
        tv_show= (TextView) findViewById(R.id.tv_show);

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.btn_build_info:
                tv_show.setText(PropertyUitls.getBuildDeviceListing());

                break;
            case R.id.btn_get_prop:
                tv_show.setText(PropertyUitls.getPropertyListing());
                break;
            case R.id.btn_set_prop:
                PropertyUitls.setProperty("my.second.name", "lilei");
                tv_show.setText(PropertyUitls.getProperty("my.second.name", ""));
                break;
        }
    }
}